package studio.ilocation.ex3mybatis.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import studio.ilocation.ex3mybatis.Service.FeaturelayerService;
import studio.ilocation.ex3mybatis.entities.FeatureLayer;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;




@RestController
@RequestMapping("/ex3")
public class LayerController {
    @Autowired
    private FeaturelayerService featLyrService;
    // 获取全部要素服务
    @GetMapping("/query/all")
    public List<FeatureLayer> queryAllFeatLyrs(){

        return featLyrService.queryAllFeatLyrs();
    }
    // 通过名字筛选获取全部要素服务
    @GetMapping("/query/all/{name}")
    public List<FeatureLayer> queryByNameFeatLyrs(@PathVariable String name) {
        return featLyrService.queryAllFeatLyrsByName(name);
    }
    // 获取只包含名字和类型要素服务
    @GetMapping("/query/only")
    public List<FeatureLayer> queryNameAndTypeFeatLyrs() {
        return featLyrService.selectOnlyNameAndTypeFeatureLayers();
    }
    // 通过名字获取只包含名字和类型要素服务
    @GetMapping("/query/only/{name}")
    public List<FeatureLayer> queryNameAndTypeByNameFeatLyrs(@PathVariable String name) {
        return featLyrService.selectOnlyNameAndTypeFeatureLayersByName(name);
   }
    
}
